package cn.edu.hit.education.action;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;

import cn.edu.hit.education.dialog.CourseDialog;
import cn.edu.hit.education.service.ICourseService;
import cn.edu.hit.education.service.IScheduleService;
import educationschedule.Activator;
import educationschedule.Application;

public class AddNewCourseAction extends Action {
	IScheduleService scheduleService = (IScheduleService)Application.applicationContext.getBean("scheduleServiceImpl");
	ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl");
	private TableViewer tableViewer;
	/**
	 * @wbp.parser.entryPoint
	 */
	public AddNewCourseAction(TableViewer tableViewer){
		this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/add_course_16px.png"));
		this.setToolTipText("添加新的课程");
		this.setText("添加课程");
		
		this.tableViewer = tableViewer;
	}
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		CourseDialog dlg = new CourseDialog(parentShell);
		if(IDialogConstants.OK_ID == dlg.open()){
			
		}
		super.run();
	}

	

}
